<?php

/*
 * Auxiliar na construção do feed
 */
App::uses('Community','Model');
App::uses('Topic','Model');
App::uses('UserHelper','View/Helper');

class FeedHelper extends AppHelper{
    public $user ;
    public $community;
    public $topic;
    
    public function __construct(View $View, $settings = array())
    {
        parent::__construct($View, $settings);
        
        $this->community = new Community();
        $this->topic     = new Topic();
    }
    
    /**
     * Buscar os topicos das comunidades que usuario faz parte
     * @param type $id Identicador do usuario logado
     * @return Array com os posts
     */
    public function getTopics($id){
        return $this->community->getTopicsFeed($id);
    }
    
    public function getPosts($id){
        return $this->topic->getPostsFeed($id);
    }
}
?>
